<!-- 会议议程 -->
<template>
  <app-page card full>
    <template #header>编辑会议议程</template>

    <WangEditor v-model="pageData.detail.content" height="520px" />

    <template #footer>
      <div class="app-toolbar">
        <el-button type="default" @click="pageActions.handleCancel()">返回</el-button>
        <el-button type="primary" @click="pageActions.handleDirectSubmit(true, true)">保存</el-button>
      </div>
    </template>
  </app-page>
</template>

<script setup>
import { usePageEdit, http } from 'jax-node'
import WangEditor from '@/components/WangEditor.vue'
import { ElMessage } from 'element-plus'

const { pageData, pageActions } = usePageEdit({
  api: 'meet/agenda'
})

const route = useRoute()
pageActions.getData = async () => {
  await http.get(pageData.api, {
    params: {
      meetId: route.query.id
    }
  }).then(res => {
    pageData.detail = res
  })
}

pageActions.handleBeforeDirectSubmit = detail => {
  if(!detail.content) {
    ElMessage.warning('会议议程内容不能为空')
    return false
  } else{
    return detail
  }
}
</script>